import Vue from "vue";
import VueRouter from 'vue-router'

Vue.use(VueRouter)
//1.定义路由组件
import HomeVue from "@/views/Home.vue";
// import MainVue from "../views/Main.vue";
import Login from "@/views/Login.vue"
import UserVue from "@/views/user/User.vue";
import RoleVue from "@/views/role/Role.vue";
import PermissionVue from "@/views/permission/Permission.vue";
import { Store } from "vuex";
//2.定义路由
const routes = [
	{
		path: '/',
		redirect: '/login'
	},
	{
		path: '/login',
		name: 'Login',
		component: Login
	},
	{
		path:'/home',
		name:'home',
		component:HomeVue,
		children:[],
	},
]

// 用于动态添加子路由函数
// export const addDynamicChildrenRoutes = (router,childrenRoutes) => {
// 	router.options.routes.find(route => route.name === home).children = childrenRoutes;
// 	router.addRoutes(childrenRoutes);
// }

//创建router实例
const router = new VueRouter({
	mode:"hash",
	routes:routes,
})

//向外暴漏router
export default router